package com.hnkywl.sts.action.cwgl.kmys;

import com.hnkywl.sts.entity.cwgl.kmys.Nbgskmdmys;
import com.hnkywl.sts.entity.sys.Gncz;
import com.hnkywl.sts.service.cwgl.kmys.NbgskmdmysService;
import com.hnkywl.sts.service.sys.GnczService;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * 颞部公司之间的科目代码映射
 * User: ccr
 * Date: 13-5-14
 * Time: 下午8:24
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/cwgl/kmys/nbgsKmdmys")
public class NbgskmdmysAction extends SimpleActionSupport {
    private NbgskmdmysService nbgskmdmysService;
    private Long syId;
    private Long xyId;
    private String khkmdm;
    private String gyskmdm;
    private int page;
    private int rows = 10;
    private Nbgskmdmys nbgskmdmys;

    //功能操作
    private List<Gncz> gnczList;
    private GnczService gnczService;

    @Action("nbgsKmdmys")
    public String nbgsKmdmys(){
        gnczList = gnczService.findGnczByJsAndUrl(request.getServletPath());
        return SUCCESS;
    }

    @Action("nbgsKmdmysList")
    public void nbgsKmdmysList(){
        renderJson(nbgskmdmysService.findNbgskmdmysList(syId,xyId,khkmdm,gyskmdm,page,rows));
    }

    @Action("save")
    public void save(){
        try{
            nbgskmdmysService.save(nbgskmdmys);
            renderJson("{\"statusCode\":200}");
        }catch (Exception  e) {
            e.printStackTrace();
            renderJson("{\"statusCode\":300,\"message\":\""+e.getMessage()+"\"}");
        }
    }

    public Long getSyId() {
        return syId;
    }

    public void setSyId(Long syId) {
        this.syId = syId;
    }

    public Long getXyId() {
        return xyId;
    }

    public void setXyId(Long xyId) {
        this.xyId = xyId;
    }

    public String getKhkmdm() {
        return khkmdm;
    }

    public void setKhkmdm(String khkmdm) {
        this.khkmdm = khkmdm;
    }

    public String getGyskmdm() {
        return gyskmdm;
    }

    public void setGyskmdm(String gyskmdm) {
        this.gyskmdm = gyskmdm;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public Nbgskmdmys getNbgskmdmys() {
        return nbgskmdmys;
    }

    public void setNbgskmdmys(Nbgskmdmys nbgskmdmys) {
        this.nbgskmdmys = nbgskmdmys;
    }

    public List<Gncz> getGnczList() {
        return gnczList;
    }

    public void setGnczList(List<Gncz> gnczList) {
        this.gnczList = gnczList;
    }

    @Autowired
    public void setGnczService(GnczService gnczService) {
        this.gnczService = gnczService;
    }

    @Autowired
    public void setNbgskmdmysService(NbgskmdmysService nbgskmdmysService) {
        this.nbgskmdmysService = nbgskmdmysService;
    }
}
